package com.kun.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.kun.entity.Blog;
import com.kun.entity.BlogType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author SunKun
 * @since 2021-06-14
 */
@Repository
public interface BlogTypeMapper extends BaseMapper<BlogType> {
    /**
     * 查询博客分类和数量
     * @return
     * @throws Exception
     */
    List<BlogType> queryBlogTypeAndBlogCount() throws Exception;

    /**
     * 查询博客类型
     * @return
     */
    @Select("SELECT id,typeName,orderNo From blogtype")
    List<BlogType> selectBlogType();

    /**
     * 后台博客类型查询分页
     * @param page
     * @return
     */
    @Select("SELECT id,typeName,orderNo FROM blogtype")
    IPage<BlogType> blogTypePage(@Param("page") IPage<BlogType> page);
}
